import React from 'react';
import { Button, Modal} from 'antd';

import {FlowConst} from "../../../Const/FlowConst";

export class ModalButton extends React.Component {
    constructor(props) {
        super(props);

        this.toggle = this.toggle.bind(this);
        this.state = {
            modal: false
        };
    }

    toggle() {
        this.setState({
            modal: !this.state.modal
        });
    }


    render() {
        const {id, buttonName, title, iconClass, buttonClass} = this.props
        return (
            <div style={{height:"100%", alignItems:'center', display:'flex' }}>
                <Button className={buttonClass} onClick={this.toggle}>{buttonName}<i id={id + '-icon'} className={iconClass} ></i></Button>
                <Modal isOpen={this.state.modal} toggle={this.toggle}  zIndex={FlowConst.SECOND_TOP_MODAL_Z_INDEX} centered={true} size={}
                  title={title}
                  footer={[
                    <Button color="secondary" onClick={this.toggle}>Cancel</Button>
                  ]}
                >
                </Modal>
            </div>
        )
    }
}
